package com.umbrella.manage.config;

import javax.sql.DataSource;

import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.boot.autoconfigure.jdbc.DataSourceBuilder;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Primary;
import org.springframework.context.annotation.PropertySource;

/**
 *
 *
 * @author Wan, ChuanLong @ 06/27/2018
 */

@Configuration
@PropertySource("classpath:datasource.properties")
public class DataSourceConfig {

    @Bean(name = "plateformDataSource")
    @Qualifier("plateformDataSource")
    @Primary
	@ConfigurationProperties(prefix = "spring.datasource.plateform")
	public DataSource plateformDataSource() {
		
		return DataSourceBuilder.create().build();
	}
	
    @Bean(name = "bssDataSource")
    @Qualifier("bssDataSource")
	@ConfigurationProperties(prefix = "spring.datasource.bss")
	public DataSource bssDataSource() {
		
		return DataSourceBuilder.create().build();
	}
}
